// 封装获取频道列表
import { useState, useEffect } from 'react'
import { getChannelsApi } from '@/apis/article'

function useChannel() {
    const [channelList, setChannelList] = useState([])
    useEffect(() => {
      // 获取频道列表
      const getChannels = async () => {
        const res = await getChannelsApi()
        setChannelList(res.data.channels)
      }
      getChannels()
    },[])
    return { channelList }
}


export { useChannel }